Skip to content

Delete autoClosingPairs from LanguageConfiguration to appease proposed API#2624

Merged
robertbrignull merged 1 commit intomainfrom
robertbrignull/autoClosingPairs
Jul 24, 2023
Merged

Delete autoClosingPairs from LanguageConfiguration to appease proposed API#2624
robertbrignull merged 1 commit intomainfrom
robertbrignull/autoClosingPairs

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

This allow the extension to start when using VS Code Insiders version 1.81.0-insider. We're running afoul of the new proposed API for autoClosingPairs.

Once the proposed API has been merged and is supported by all VS Code versions we aim to support, we can remove this line and pass in autoClosingPairs in the LanguageConfiguration object.

I've tested it and we do still get autoClosingPairs behaviour because we're still passing it in language-configuration.json. This seems to still work and it accepts the value and provides the desired behaviour.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team as a code owner July 21, 2023 10:36
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/,
};
delete langConfig.autoClosingPairs;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be unfortunate if we have to lose this functionality in regular vscode as well.

According to copilot, this snippet should let us determine what kind of vscode we are running in. Maybe we can use this to conditionally delete the autoClosingPairs.

import * as vscode from 'vscode';

if (vscode.env.appName === 'Visual Studio Code') {
  console.log('Extension is running in Visual Studio Code');
} else if (vscode.env.appName === 'Visual Studio Code - Insiders') {
  console.log('Extension is running in Visual Studio Code Insiders');
} else {
  console.log('Extension is running in an unknown application');
}

Though at some point, this needs to be reimplemented using the new API.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...I missed the fact that we're still getting the auto-close behaviour. Since this file is only used for the onEnterRules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the functionality still works, (at least it does when I test it), because autoClosingPairs is still in the json file.

Maybe we're skirting the rules by keeping autoClosingPairs in the json file, since it means we're using a proposed API feature but in a way where they don't catch it and stop us. Or maybe the json file API is genuinely a different API and that one isn't changing, so it's all fine. That would make sense since it would mean that this proposed API change is bringing the two APIs closer together in terms of features. I haven't interacted with this area before and I don't know enough to say either way.

Copy link
Copy Markdown
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fine to go in as-is.

@robertbrignull
Copy link
Copy Markdown
Contributor Author

Confirmed again that this starts correctly and the auto-closing pairs functionality works on both normal and insiders versions of VS Code.

@robertbrignull robertbrignull merged commit c7b556e into main Jul 24, 2023
@robertbrignull robertbrignull deleted the robertbrignull/autoClosingPairs branch July 24, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants